home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / restruc.zip / RESTRUC.PAS < prev   
Pascal/Delphi Source File  |  1993-01-04  |  2KB  |  58 lines

  1. {è{                        RESTRUC.PAS
  2.  
  3.   Renames subdirectories and files, moves files to different
  4.   directories without copying the file (directory change only).
  5.   Restruc can also be used to rename files.Renaming directories
  6.   only works in DOS 3.0 or above.
  7.  
  8.   Derived from Michael Toutonghi's idea in PC MAGAZINE, I
  9.   simply added error checking for no command line entry,
  10.   duplicate filenames or non-existent files. I also added
  11.   a help message that only prints if the restructure is
  12.   not successful.
  13.  
  14.                         Loren Cook
  15.                         January 15, 1986
  16.                         Compuserve 70015,1101
  17.  
  18.   Copyright (c) 1986 by Loren J. Cook
  19.  
  20.   Unlimited free use and reproduction of this text and the program
  21.   associated with it are hereby granted to all users provided that
  22.   no charge or levy is made for the use, copying or operation
  23.   thereof. The right to sell this text or any of the programs
  24.   associated therewith is expressly not granted to any person, firm
  25.   or corporation.                                                             }
  26.  
  27.  
  28. PROGRAM Restruc;
  29.  
  30. VAR file_to_change : FILE;
  31.  
  32. PROCEDURE Help;
  33. BEGIN
  34.   WRITELN;
  35.   LOWVIDEO; WRITELN('RESTRUC Help:');
  36.   WRITELN;
  37.   NORMVIDEO; WRITELN('RESTRUC \subdir\filename \subdir\filename');
  38.   LOWVIDEO; WRITELN('moves a file from one subdirectory to another');
  39.   WRITE('or ');
  40.   NORMVIDEO; WRITE('RESTRUC \subdir \subdir');
  41.   LOWVIDEO; WRITELN(' renames a subdirectory.');
  42.   NORMVIDEO;
  43.   HALT;
  44. END;
  45.  
  46. BEGIN
  47.   IF PARAMSTR(1) = '' THEN Help;
  48.   ASSIGN(file_to_change, PARAMSTR(1));
  49.   {$I-}
  50.   RENAME(file_to_change, PARAMSTR(2));
  51.   {$I+}
  52.   IF IORESULT > 0 THEN BEGIN;
  53.     WRITELN;
  54.     WRITELN('Unable to find file or duplicate filename!');
  55.     Help;
  56.     END;
  57. END.
  58.